package com.tensai.study.新概念.响应式编程.reactor.flux;

import org.junit.Test;
import reactor.core.publisher.Flux;

/**
 * @author Tensai
 */
public class WindowTest {

    @Test
    public void test() {
        //从起始位置开始将source sequence拆分成固定大小的flux
        Flux<Flux<Integer>> window = Flux.range(1, 10)
                .window(3);
//subscribe1
        window.subscribe(integerFlux -> {
            System.out.println("+++++分隔符+++++");
            integerFlux.subscribe(System.out::println);
        });
        System.out.println("---------- 分割线1 ----------");

//subscribe2
        window.toStream().forEach(integerFlux -> {
            System.out.println("+++++分隔符+++++");
            integerFlux.subscribe(System.out::println);
        });
        System.out.println("---------- 分割线2 ----------");

    }
}
